//  @ Project : GagalPanen
//  @ File Name : grid.hpp
//  @ Date : 3/9/2011
//  @ Author : 
//
//


#if !defined(_GRID_H)
#define _GRID_H

#include <vector>
#include <string>
#include <fstream>
#include "gameinterface.hpp"
#include "cell.hpp"
#include "direction.hpp"
#include "actiontype.hpp"

class Grid {
public:
  // normal constructor
  Grid(GameInterface* game, std::vector<std::string> map);

  // load game constructor
  Grid(GameInterface* game, std::ifstream& is);

  virtual void save(std::ofstream& os);

  virtual ~Grid();
  bool containsCell(Cell* cell);
  Cell* getCellAt(int x, int y);
  Cell* getCellInFrontOff(Cell* cell, Direction dir);
  int getColumn();
  int getRow();
  void advanceDay();
  void advanceTime();
  std::vector<ActionType> getShortestPathBetween(
      Cell* init_cell, Direction init_direction,
      Cell* destination_cell, Direction dest_direction);
  int getX(Cell* cell);
  int getY(Cell* cell);
protected:
  GameInterface* game_;
private:
  std::vector< std::vector< Cell*> > grid_rep_;
  void checkRep();
  
};

#endif  //_GRID_H
